import {
  getUserInfo
} from '@/api/user.js'
export default {
  namespaced: true,
  state: {
    userToken: uni.getStorageSync('userToken'),
    userInfo: {},
    loudong: {},
    unit: {}
  },
  mutations: {
    setUserToken(state, payload) {
      state.userToken = payload
    },
    setUserInfo(state, payload) {
      state.userInfo = payload
    },
    setLoudong(state, payload) {
      state.loudong = payload
    },
    setUnit(state, payload) {
      state.unit = payload
    }
  },
  actions: {
    async loadUserInfo(context) {
      const res = await getUserInfo()
      // console.log(res)
      context.commit('setUserInfo', res.data)
    }
  },
  getters: {},
}
